package cn.hss.object.stat;

import com.sun.org.apache.xml.internal.serializer.ToSAXHandler;
import java.time.LocalDateTime;

/**
 * @author 作者：HeShaoShuai
 * @Email 邮箱：2569819541@qq.com
 * @Date 日期：2023/4/25 20:08
 * @Package 包名：cn.hss.object.stat
 * @Project 项目名：JavaSE
 * @Version 1.0
 */
public class User {
	Long userName;
	String password;
	private LocalDateTime createTime;//创建时间
	//使用非静态代码块提取构造器方法中公共代码
	{
		System.out.println("新用户注册");
		createTime=LocalDateTime.now();
	}
	public User(){
        /*包含无参构造，
           - 输出“新用户注册”，
           - createTime赋值为当前系统时间，
           - username就默认为当前系统时间值，
           - password默认为“123456”*/
//        System.out.println("新用户注册");
//        createTime=LocalDateTime.now();
		userName=System.currentTimeMillis();
		password="123456";
	}

	public User(Long userName, String password) {
        /*- 输出“新用户注册”，
          - createTime赋值为当前系统时间，
           - username和password由参数赋值*/
//        System.out.println("新用户注册");
//        createTime=LocalDateTime.now();
		this.userName = userName;
		this.password = password;
	}

	@Override
	public String toString() {
		return "User{" +
				"userName='" + userName + '\'' +
				", password='" + password + '\'' +
				", createTime=" + createTime +
				'}';
	}

	public Long getUserName() {
		return userName;
	}

	public void setUserName(final Long userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(final String password) {
		this.password = password;
	}

	public LocalDateTime getCreateTime() {
		return createTime;
	}
}
